from rest_framework import pagination
from rest_framework.response import Response

import math

class CustomPagination(pagination.PageNumberPagination):
    page_query_param = 'currentPage'
    page_size_query_param = 'pageSize'
    page_size = 10

    def get_paginated_response(self, data):

        ps = self.get_page_size(self.request)
        print(ps)
        return Response({
            'status':True,
            'data':{
                'showCount': ps,
                'totalPage': math.ceil(self.page.paginator.count * 1.0 / ps),
                'totalResult': self.page.paginator.count,
                'currentPage': self.page.number,
                'dataList': data
            }
        })
